package com.hotel.project.common.util;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * TODO
 *
 * @author: peng.ni
 * @date: 2022/04/13
 */
public class SortUtils {
    public static String sort(String optionIds) {
        String newOptionIds = "";

        String[] split = optionIds.split(",");
        List<String> list = Arrays.asList(split);
        Collections.sort(list);
        for (int i = 0; i < list.size(); i++) {
            if (i == list.size() - 1) {
                newOptionIds += list.get(i);
            } else {
                newOptionIds += list.get(i) + ",";
            }
        }
        return newOptionIds;
    }
}
